%load_ext autotime
%load_ext autoreload
%autoreload 2
time: 8.58 ms (started: 2021-11-14 00:34:33 +00:00)
# External depences
import pandas as pd
import numpy as np
import plotly.express as px
# Move path to parent folder
import sys
sys.path.insert(1, '../')
# Internal dependences
from filecoin_metrics.connection import get_connection, get_connection_string
from filecoin_metrics.metrics import *
time: 505 ms (started: 2021-11-14 00:34:33 +00:00)
conn_string = get_connection_string('../config/sentinel-conn-string.txt')
connection = get_connection(conn_string)
time: 1.16 s (started: 2021-11-14 00:34:33 +00:00)
s = rate_missing_post_network_weekly(connection)
px.bar(s, log_y=True)
time: 55.8 s (started: 2021-11-14 00:34:35 +00:00)
s = fraction_missing_post_network_weekly(connection)
px.bar(s)
time: 51.1 s (started: 2021-11-14 00:35:30 +00:00)
d = rate_missing_post_miner_weekly(connection)
s = declare_fault_count_per_miner(connection) print(s.sort_values(ascending=False).head(10))
from filecoin_metrics.metrics import declare_fault_weekly
s = declare_fault_weekly(connection)
fig_df = s.reset_index()
fig = px.bar(fig_df,
x='timestamp',
y='declare_fault_count',
title='Weekly Declare Fault Count',
log_y=True)
fig.show()
time: 406 ms (started: 2021-11-14 00:36:22 +00:00)
from filecoin_metrics.metrics import renewal_count_per_epoch
s = renewal_count_per_epoch(connection)
INTERVAL = '1w'
s_count = (s.resample(INTERVAL)
.sum()
.backfill()
)
s_cum = (s.cumsum()
.resample(INTERVAL)
.median()
.backfill()
)
s_cum.name = 'renewal_count_cumulative'
fig_df = (pd.DataFrame([s_count, s_cum])
.T
.reset_index()
.melt(id_vars=['timestamp'])
)
fig = px.bar(fig_df,
x='timestamp',
y='value',
title='Renewal Events Count',
facet_col='variable',
log_y=True)
fig.show()
time: 17.7 s (started: 2021-11-14 00:36:22 +00:00)